<?php
/*
 * Licensed this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

namespace org\boapi\shop;

include_once (__DIR__ . '/ISBN.php');

/**
 * International Standard Book Number [ISBN] since 01.01.2007.
 * @author Sebastian Ritter
 * @version 1.0.0.0
 * @license Apache License Version 2.0
 */
final class ISBN13 extends \org\boapi\shop\ISBN {
  private $eanDelegateObject;
  /**
   * Construct
   */
  public function ISBN13 () {
    $this.$eanDelegateObject = new GTIN ();
  }
  /// <summary>
  /// Set the ISBN
  /// </summary>
  /// <param name="isbn"></param>
  public function setCompleteValue ($isbn) {
    $this.$eanDelegateObject->setCompleteValue($isbn);
    if ("978" != substr ($this.$eanDelegateObject->getNumber(),0,3)  
     || "979" != substr ($this.$eanDelegateObject->getNumber(),0,3)) {
      throw new exception ("Number is not an ISBN, because it starts not with 978 or 979");
    }
  }

  /// <summary>
  /// Is the checknumber correct
  /// </summary>
  /// <returns></returns>
  public function isChecknumberCorrect () {
    return $this.$eanDelegateObject->isChecknumberCorrect ();
  }
  /// <summary>
  /// Set the checknumber
  /// </summary>
  /// <param name="digit"></param>
  protected function setChecknumber ($digit) {
    $this.$eanDelegateObject->setChecknumber (digit);
  }
  /// <summary>
  /// Return the checknumber
  /// </summary>
  /// <returns></returns>
  protected function getChecknumber () {
    return $this.$eanDelegateObject->getChecknumber ();
  }
  /// <summary>
  /// The number of ISBN
  /// </summary>
  /// <returns></returns>
  public function getNumber () {
    return $this.$eanDelegateObject->getNumber();
  }

}
?>